package checker

import (
	"mi/compiler/ast"
	"mi/compiler/binder"
)

type EmitResolver interface {
	GetTypeOfSymbol(symbol *binder.Symbol) Type
	GetRealSymbolName(symbol *binder.Symbol) string
	GetResolvedSymbol(node ast.Node) *binder.Symbol
	GetTypeFromNode(node ast.Node) Type
	GetResolvedSignature(node ast.Node) (*Signature, []*Signature)

	TypeToString(tpe Type, enclosingDeclaration ast.Node, includeAlias bool) string
	SymbolToString(symbol *binder.Symbol, enclosingDeclaration ast.Node, meaning binder.SymbolFlags, includeAlias bool) string
}

func (c *checker) GetRealSymbolName(symbol *binder.Symbol) string { return c.getRealSymbolName(symbol) }
func (c *checker) getRealSymbolName(symbol *binder.Symbol) string {
	if symbol.Flags&binder.AliasLike != 0 {
		return c.getAliasSymbolMappedName(symbol)
	}

	return symbol.Name
}
func (c *checker) GetResolvedSymbol(node ast.Node) *binder.Symbol {
	var link = c.getNodeLinks(node)
	return link.resolvedSymbol
}
func (c *checker) GetTypeFromNode(node ast.Node) Type {
	return c.getTypeFromNode(node)
}

